%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
README file for "Do citizens enforce accountability for public goods provision? Evidence from India’s rural roads program"
- Author: Tanushree Goyal
- Date: January 20,2023
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


DIRECTORIES
-----------

The package is divided into four folders:

 - 0_Scripts
 - 1_Data
 - 2_Tables
 - 3_Figs

Each folder has Stata .do files, datasets in .dta form, table outputs in .doc form, and figures in PDFs, respectively, and the 0_Scripts and 1_Data folder must both be downloaded and placed in the same parent directory for the code to run. That said, the choice of parent directory is upto the user. The 2_Tables and 3_Figs folders must be available in the same parent directory to allow for storing output, though they need not contain the pre-existing files. All output from running the code will be made available in these two folders.

Please set the path to the directory "Replication - Roads" at the beginning of each file.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


SCRIPTS
-------

STATA

All the .do files available in the 0_Scripts folder can be run independently, together, or in any order and combination the user wishes. To run each code file, one can simply open the file, and press the execute button on the Stata Do-File Editor window to run the entire code at once. The shortcuts for the same are Ctrl + D on Windows, and ⌘ + Shift + D on Mac OS. While the order of opening each file, whether together or in individual Stata windows, does not matter, one must take caution to make sure that the working directory is set as the 0_Scripts folder itself. To do so, one can either open the Do files in the folder in a separate Stata window, or manually set the current working directory as the 0_Scripts folder using the cd command. Each Stata code file serves the following functions:

  -  1_SummaryStats: Provides a table of summary statistics (Appendix B.4 Table)
  -  2_Pre-trends: Examines pretrends in eligibility instrument (Appendix E.1-E.3 Tables)
  -  3_Binscatter: Plots electricity and latrine availability against population (Figure C2)
  -  4_Balance: Plots coefficients of placebo tests for instrument exogeneity (Figure C1)
  -  5_ConnectivityPanel: Plots histograms of total connectivity (Figure 1)
  -  6_DataFigs: Plots histograms and scatters describing the data (Figures 2 and 3)
  -  7_PMGSY: Placebo checks based on PMGSY allotment (Appendix E.4 and E.5 Tables)
  -  8_OLSResults: Runs OLS regressions and generates Table 1
  -  9_IVResults: Runs IV regressions and generates Table 2
  -  10_UPData: Runs regressions on UP Polling Data (Table 3 and Appendix F Tables)
  -  11_Corruption: Runs regressions on quality and corruption (Appendix G.1 Table)
  -  12_Accountability: Regressions on attribution and accountability (Appendix G.2 Tables)
  -  13_Myopia: Regressions on voter myopia (Appendix G.3 Tables)
  -  14_Information: Regressions on information rich environments (Appendix G.4 Tables)
  -  15_Competition: Regressions on electoral competition (Appendix G.5 and G.6 Tables)

Stata packages required
**ssc install ivreg2
*ssc install blindschemes
*ssc install binscatter
**ssc install coefplot

R

All the .R files in the 0_Scripts folder can also be run in any order as long as the initial working directory is set as the 0_Scripts folder. The user can run the entire code file at once, and the relevant output files will be generated into the 2_Tables or the 3_Figs folders. Each R code file serves the following purpose:

  -  01_RDPlot: Generates the RD plot in Figure 3A
  -  02_MatchingTable: Generates matching results and PMGSY project count plot. These are the table and figure in Appendix B.2. One thing to note is that the code to process and generate the table is in the file 02_MatchingTable.Rmd, and the .R file calls the markdown file to generate the output PDF in the 2_Tables folder

R packages required
library(logr)
library(ggplot2)
library(rmarkdown)
library(dplyr)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


TABLES AND FIGURES
------------------

Each output table and figure is stored in the 2_Tables and 3_Figs folder respectively. For tables, all appendix tables are named as per the subsection they occur in. That is, B4.doc is the file containing the table that occurs in subsection B.4 of the appendix. The regression tables that occur in the body of the paper are named as Manuscript_Table#_Model.doc. Figures, on the other hand, are named by the figure label itself. As such, Fig1.pdf would refer to Figure 1 in the paper, and an alphabet after a figure number would indicate the subfigure label. So Fig1A.pdf would refer to subplot A of Figure 1.



